package com.common.base.dao;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.common.base.entity.BaseEntity;
import com.common.base.exceptions.DaoException;
import com.common.tag.Page;

public interface BaseDao<T extends BaseEntity> {

	public static final String _FIND = ".find";
	public static final String _INSERT = ".insert";
	public static final String _DELETE = ".delete";
	public static final String _UPDATE = ".update";
	
	public static final String GLOBAL_FACILITY_KEY="globalFacilityId";

	public List<T> findByParams(Map<String, Object> params);
	
	public BigDecimal insert(T entity) throws DaoException; // 返回SID

	public int delete(T entity); // 返回行数

	public int update(T entity); // 返回行数
	
	public T findBySid(Long sid); // 返回单条数据
	
	public Boolean isExsit(Map<String, Object> params);

	
	// public void updateAll(T entity);
	// public void insertAll(T entity);
	// 
	// public List<T> findPageByParams(int first, int max);
	// public List<T> findAll();
	// public T findEntityBySid(Long sid);
	
	/**
	 * 分页查询
	 * curPage 当前页码
	 * pageSize 每页显示的记录条数
	 * */
	//@SuppressWarnings("unchecked")
	public Page<T> findByPage(Map<String, Object> params, int curPage, int pageSize);

}
